<!doctype html>
<html lang="en">
  <head>
    <title>vue操作</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  </head>
  <body>
    <div class="container" id="app">
        <h2>{{title}}</h2>
    </div>
    <div class="container">
        <div class="form-group">
            <!-- v-model是vue的指令 将当前这个输入框的值绑定到vue对象的task上,将task的值绑定到这个输入框上 -->
          <input type="text" v-model="task" class="form-control" name="account" id="account" placeholder="请输入今天要做的事情">
        </div>
        <button type="button" @click="addTask()" class="btn btn-primary btn-lg btn-block offset-4 col-md-3">提交</button>
        <ul class="list-group">
            <!-- <li class="list-group-item " v-for="(tas,index) in alltask":key="index">{{task}}</li> -->
            <li class="list-group-item">上午第一节课上课不迟到  </li>
            <li class="list-group-item">早起吃早餐</li>
            <li class="list-group-item ">交实训日志</li>
        </ul>
        <button type="button"  class="btn btn-danger btn-lg btn-block offset-4 col-md-3">清除上述所有的任务</button>
    </div>
    <!-- 引入的vue的js文件 -->
    <script src="https://unpkg.com/vue@next"></script>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>
<script>
    const vue = Vue.createApp({
        data() {
            return {
                
                title:"vue的入门---wangkunji",
                task:"haahhahaa",
                alltask:["早起","吃早餐","上课"],
                
            }
        },
        methods: {
            addTask:function(){
                /* this.task; */
            this.alltask.push(this.task);
            this.task = ""; //绑定输入框，输入框清空
            },
            clearTask:function(){
              this.alltask = [];
            }
        },
    })

    vue.mount("#app");
   
</script>